package es.deusto.ingenieria.aike.puzzle;

public class Environment 
{
	private Board board;
	private Car car;
	private Flag flag;
	
	public Environment(Board board, Car car, Flag flag)
	{
		this.board = new Board(board.getTam(),board.getTiles());
		this.car = new Car(car.getDirection(), car.getY(), car.getX());
		this.flag = new Flag(flag.getPosition(), flag.getWallSituation());
	}

	public Board getBoard() {
		return board;
	}

	public void setBoard(Board board) {
		this.board = board;
	}

	public Car getCar() {
		return car;
	}

	public void setCar(Car car) {
		this.car = car;
	}

	public Flag getFlag() {
		return flag;
	}

	public void setFlag(Flag flag) {
		this.flag = flag;
	}
	
	public Environment clone() 
	{
		return new Environment(this.getBoard(), this.getCar(), this.getFlag());
	}
	
	public String toString()
	{
		return this.car.toString();
	}
	
	public boolean equals(Environment env)
	{
		return (this.board.equals(env.getBoard()) && this.car.equals(env.getCar()) 
				  && this.flag.equals(env.getFlag()));
	}
}
